import Vue from "vue";
import Element from "element-ui";
import "./styles/element-variables.scss";

import "@/styles/index.scss"; // global css

import App from "./App";
import store from "./store";
import router from "./router";
import directive from "./directive"; // directive
import plugins from "./plugins"; // plugins

import { config } from "./config";
Vue.prototype.config = config;

//全局通用的工具函数
import * as utils from "@/utils/index";
Vue.prototype.utils = utils;

//本地存储统一管理
import * as storage from "@/utils/storage";
Vue.prototype.storage = storage;

const bus = new Vue();
Vue.prototype.$bus = bus;

//echarts 懒加载
import "components/echarts";

//加载loading
import { openLoading } from "@/common/js/loading.js";
Vue.prototype.openLoading = openLoading;
//提示信息
import DonMessage from "@/common/js/message.js";
Vue.prototype.message = new DonMessage(); //消息提示
// 全局注入自己封装的组件
import globalComp from "components";
Vue.use(globalComp);

import "./assets/icons"; // icon
import "./permission"; // permission control

// 头部标签组件
import VueMeta from "vue-meta";
// 正式环境清除所有console.log
if (process.env.NODE_ENV === "production") {
  if (window) {
    window.console.log = function () {};
  }
}

// 全局方法挂载
Vue.use(directive);
Vue.use(plugins);
Vue.use(VueMeta);

Vue.use(Element, { size: "small", zIndex: 3000 });

Vue.config.productionTip = false;

const vm = new Vue({
  el: "#app",
  router,
  store,
  render: (h) => h(App),
});
export default vm;
